
#if(NOT CMAKE_COMPILER_IS_GNUCXX)
 #   message(FATAL_ERROR "compiler is not GNU")
#else ()
#    message(STATUS "compiler is GNU")
#endif()
message(STATUS "compiler is ${CMAKE_CXX_COMPILER}")
#set(CMAKE_CXX_COMPILER "g++")


set(CXX_FLAGS
 -DCHECK_PTHREAD_RETURN_VALUE
 -D_FILE_OFFSET_BITS=64
 -Wall
 -Wextra
 #-Wsystem-headers
 -Werror
 -Wno-unused-parameter
 -Woverloaded-virtual
 -Wpointer-arith
 -Wshadow
 -Wwrite-strings
 -march=native
 -MMD
 -std=c++11
 
 )


	 
include(${CMAKE_ROOT}/Modules/CheckCXXCompilerFlag.cmake)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)


if(NOT COMPILER_SUPPORTS_CXX11)
    message(FATAL_ERROR "compiler do not supoort c++11")
endif()

if(CMAKE_COMPILER_IS_GNUCXX)
	set(CXX_FLAGS "${CXX_FLAGS} -rdynamic")
else()
	include_directories("/usr/include/c++/v1/")
	set(CXX_FLAGS "${CXX_FLAGS} -stdlib=libc++")
	#set(CXX_FLAGS "${CXX_FLAGS} -Weverything")
	set(CXX_FLAGS "${CXX_FLAGS} -Wno-implicit-fallthrough")
	#set(CXX_FLAGS "${CXX_FLAGS} -Wno-covered-switch-default -Wno-documentation -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-disabled-macro-expansion ")
	#set(CXX_FLAGS "${CXX_FLAGS} -Wno-global-constructors -Wno-weak-vtables -Wno-padded -Wno-float-equal -Wno-exit-time-destructors -Wno-missing-prototypes -Wno-old-style-cast")
endif()

 string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CXX_FLAGS}")
 set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g  -ggdb3")
 set(CMAKE_CXX_FLAGS_RELEASE "-O2 -g -ggdb3")
